<div class="panel panel-default">
    <div class="panel-body">
        {{$groups := .groups}}{{$keywords := .keywords}}{{$projects := .projects}}{{$isBlock := .isBlock}}
        <ul class="nav nav-tabs">
            {{range $group := $groups}}
                <li {{if eq $keywords.group_id $group.group_id }} class="active" {{end}}><a
                            href="/publish/project?group_id={{$group.group_id}}">{{$group.name}}</a></li>
            {{end}}
        </ul>
    </div>
    <div class="panel-body">
        <div class="row">
            <form action="/publish/project" method="get">
                <div class="col-md-9">
                    <div class="input-group">
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="input-group">
                        <input class="form-control" name="keyword" type="text" value="{{$keywords.keyword}}"
                               placeholder="项目名">
                        <input name="group_id" type="hidden" value="{{$keywords.group_id}}">
                        <span class="input-group-btn">
				              <button type="submit" class="btn btn-primary"><i
                                          class="glyphicon glyphicon-search"></i></button>
				            </span>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th class="w13p">项目名</th>
                <th>代码地址</th>
                <th class="w13p">发布分支</th>
                <th class="w13p">上一次发布时间</th>
                <th class="w20p">操作</th>
            </tr>
            </thead>
            <tbody>
            {{range $project := $projects}}
                <tr>
                    <td>{{$project.name}}</td>
                    <td>
                        <a name="code_info"
                           data-link="/publish/info?project_id={{$project.project_id}}">{{$project.repository_url}}</a>
                    </td>
                    <td class="center">
                        <label class="text-info">{{$project.branch}}</label>
                    </td>
                    <td class="center">
                        {{if eq $project.last_publish_time "0"}}
                            0
                        {{else}}
                            {{dateFormat $project.last_publish_time "Y-m-d H:i:s"}}
                        {{end}}
                    </td>
                    <td class="center">
                        {{if not $isBlock}}
                            <a name="publish" href="/publish/publish?project_id={{$project.project_id}}"><i
                                        class="glyphicon glyphicon-ok-circle"></i>发布</a>
                            <a name="reset" href="/publish/reset?project_id={{$project.project_id}}"><i
                                        class="glyphicon glyphicon-share-alt"></i>回滚</a>
                        {{end}}
                        <a name="history" data-link="/publish/history?project_id={{$project.project_id}}"><i
                                    class="glyphicon glyphicon-align-justify"></i>历史</a>
                    </td>
                </tr>
            {{end}}
            </tbody>
        </table>
    </div>
    <div class="panel-footer">
    </div>
</div>
<script type="text/javascript">
    {{if $isBlock}}
    Common.warningBox("#failedBox", '{{ .block.block_message }}，封版时间为：{{dateFormat .block.block_start_time "Y-m-d H:i:s"}}至{{dateFormat .block.block_end_time "Y-m-d H:i:s"}}');
    {{end}}
    Layers.bindIframe("[name='history']", "项目发布历史", "510px", "1050px");
    Layers.bindIframe("[name='code_info']", "项目详细信息");
</script>